#include <iostream>
#include <cstring>

using namespace std;

void ReverseSentence(char *sentence)
{
	int len = strlen(sentence);
	for(int i = 0, j = len - 1; i < j; i++, j--)
	{
		char temp = sentence[i];
		sentence[i] = sentence[j];
		sentence[j] = temp;
	}

	int i = 0, j, k = 0;
	while(true)
	{
		while(sentence[k] != ' ' && sentence[k] != '\0') k++;
		j = k - 1;
		while(i < j)
		{
			char temp = sentence[i];
			sentence[i] = sentence[j];
			sentence[j] = temp;
			i++;
			j--;
		}
		if(sentence[k] == '\0')
			break;
		i = ++k;
	}
}

int main()
{
	char s[100] = "I am a student.";
	ReverseSentence(s);
	cout<<s<<endl;
}
